import type { ComponentInternalInstance } from "vue";
import { getCurrentInstance } from "vue";
import Cheese, { Cheese as CHEESE } from '@/common/Cheese';

/*系统api规则*/
interface GetAppType {
    Vm: "Vm"
}

export function getAnyApp<K extends keyof GetAppType>(keys?: K[]) {

    let Vm: ComponentInternalInstance | null = null;

    if (keys)
        for (let i: number = 0; i < keys.length; i ++) {
            switch (keys[i]) {
                case "Vm":
                    Vm = getCurrentInstance()!;
                    break;
            }
        }

    return {
        Cheese,
        CHEESE,
        Vm
    }
}
